package com.装饰器模式;

/**
 * 动物装备
 * @author Fang Ruichuan
 * @date 2022-09-29 9:56
 */
public abstract class AnimalEquipment extends Animal {
    private Animal animal;

    public AnimalEquipment(Animal animal) {
        this.animal = animal;
    }

    @Override
    public void move() {
        beforeMove();
        animal.move();
        afterMove();
    }

    @Override
    public void bite() {
        beforeBite();
        animal.bite();
        afterBite();
    }

    // 移动前的能力增强
    protected abstract void beforeMove();

    // 移动后的能力增强
    protected abstract void afterMove();

    // 咬你前的能力增强
    protected abstract void beforeBite();

    // 咬你后的能力增强
    protected abstract void afterBite();
}
